import request from '@/utils/request'

export function tree_list() {
    return request({
        url: '/mall_product/admin/category/shop_category/tree',
        method: 'get'
    })
}

export function category_del(id) {
    return request({
        url: `/mall_product/admin/category/${id}`,
        method: 'delete'
    })
}

export function category_level_list(level) {
    return request({
        url: `/mall_product/admin/category`,
        method: 'get',
        params: {
            level
        }
    })
}

export function category_children_list(id) {
    return request({
        url: `/mall_product/admin/category/c/${id}`,
        method: 'get'
    })
}

export function category_parent(id) {
    return request({
        url: `/mall_product/admin/category/p/${id}`,
        method: 'get'
    })
}


export function category_save(data) {
    return request({
        url: `/mall_product/admin/category`,
        method: 'post',
        data
    })
}
export function category_by_id(id) {
    return request({
        url: `/mall_product/admin/category/${id}`,
        method: 'get'
    })
}
export function category_update(data) {
    return request({
        url: `/mall_product/admin/category`,
        method: 'put',
        data
    })
}

export function platform_first_category(level) {
    return request({
        url: `/mall_product/admin/category/platform_first_category`,
        method: 'get'
    })
}


export function platform_category() {
    return request({
        url: `/mall_product/admin/category/platform_category`,
        method: 'get'
    })
}
export function shop_category() {
    return request({
        url: `/mall_product/admin/category/shop_category`,
        method: 'get'
    })
}